import 'normalize.css'
import './index.less'
import './section/banner'

document.querySelector('.menu').addEventListener('click', (e) => {
  const target = e.target as HTMLDivElement
  if (target.classList.contains('submenu')) {
    console.log(target.dataset.to)
    const to = document.getElementsByClassName(target.dataset.to) as HTMLCollectionOf<HTMLDivElement>
    if (to?.[0]) {
      window.scrollTo(0, to[0].offsetTop)
    }
  }
})

document.querySelector('.goTop').addEventListener('click', () => {
  window.scrollTo(0, 0)
})
